
<%@ page import="report.Plan" %>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
        <meta name="layout" content="main" />
        <title>iPET - Planejamento</title>
    </head>
    <body>
        <g:render template="/common/menuPlan" />
        <div id="text">
        <div class="body">
            <h2>Editar planejamento</h2>
            <g:if test="${flash.message}">
            <div class="message">${flash.message}</div>
            </g:if>
            <g:hasErrors bean="${planInstance}">
            <div class="errors">
                <g:renderErrors bean="${planInstance}" as="list" />
            </div>
            </g:hasErrors>
            <g:form method="post" >
                <g:hiddenField name="id" value="${planInstance?.id}" />
                <g:hiddenField name="version" value="${planInstance?.version}" />
                <div class="dialog">
                    <table>
                        <tbody>
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="year"><g:message code="plan.year.label" default="Ano" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: planInstance, field: 'year', 'errors')}">
                                 <g:select name="year" from="${1970..2010}" value="${fieldValue(bean: planInstance, field: 'year')}"  />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="activities"><g:message code="plan.activities.label" default="Atividades" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: planInstance, field: 'activities', 'errors')}">
                                    <g:select name="activities" from="${report.Activity.list()}" optionKey="id" optionValue="nature" multiple="multiple" value="${planInstance?.activities*.id}"  />
                                </td>
                            </tr>
                            <tr class="prop">
                                <td valign="top" class="name">
                                  <label for="observation"><g:message code="plan.observation.label" default="Observações" /></label>
                                </td>
                                <td valign="top" class="value ${hasErrors(bean: planInstance, field: 'observation', 'errors')}">
                                    <g:textArea name="observation" value="${planInstance?.observation}" />
                                </td>
                            </tr>
                        </tbody>
                    </table>
                </div>
                <div class="buttons">
                    <span class="button"><g:actionSubmit class="save" action="update" value="Salvar" /></span>
                    <span class="button"><g:actionSubmit class="delete" action="delete" value="Remover" onclick="return confirm('${message(code: 'default.button.delete.confirm.message', default: 'Tem certeza ?')}');" /></span>
                </div>
            </g:form>
        </div>
        </div>
    </body>
</html>
